document.write("<script src='/js/server.js'></script>");
// 导航菜单的间隔像素
var sysid = 1;
function nemu() {
    var liStr= "",css="layui-nav-itemed";
    get("/GiFuninfo/getMenu", {YHRYID:user.YHRYID,XTMKID:sysid}, function (data) {

        if (data.code == 0) {
            var syss = data.data.filter(function (e) {
                return e.FLDYID == 17;
            });

            for (var s = 0; s < syss.length; s++) {
                var rows = data.data.filter(function (e) {
                    return e.FLDYID == syss[s].GNDYID;
                });
                for (var i = 0; i < rows.length; i++) {
                    if(i>0)
                        css="";
                    liStr += " <li class=\"layui-nav-item  "+css+"\">\n" +
                        "                    <a href=\"javascript:;\" class=\"layui-menu-item-divider\">" + rows[i].GNDYMC + "</a>\n";
                    var childs = data.data.filter(function (e) {
                        return e.FLDYID == rows[i].GNDYID;
                    });
                    if (childs.length > 0) {
                        liStr += "                    <dl class=\"layui-nav-child\">   \n";
                        for (var j = 0; j < childs.length; j++) {
                            liStr += "                        <dd><a href=\"javascript:;\" data-url=\""+childs[j].DYXZTP+"\">" + childs[j].GNDYMC + "</a></dd>\n";
                        }
                        liStr += "                    </dl>\n";
                    }
                    liStr += "                </li>\n";
                    liStr +=" <li class=\"layui-menu-item-divider\"></li>";
                }
            }
        }
    })
   $("#menu").html(liStr);

}

function loadSys(){
    var syshtml="";
    get("/GiUsersys/getList", {YHRYID:user.YHRYID}, function (data) {
        for (var i = 0; i < data.data.length; i++) {
            if(i==0){
                sysid=data.data[i].XTMKID
                syshtml=" <a href=\"javascript:;\" class=\"white\" data-id=\""+data.data[i].XTMKID+"\">"+data.data[i].XTMKMC+"</a>";
            }
            else
            {
                syshtml+="            <dl class=\"layui-nav-child\">\n" +
                    "                    <dd><a href=\"javascript:;\" data-id=\""+data.data[i].XTMKID+"\">"+data.data[i].XTMKMC+"</a></dd>\n" +
                    "                 </dl>";
            }
        }
    })
}

// 页面切换
$(document).on('click', '#menu a', function(){
    var thisPage = $(this).attr("data-url");
    if(typeof(thisPage) != "undefined"){
        if($('.layui-body iframe').attr('src') == thisPage)return;
        $('.layui-body iframe').attr('src', thisPage)
    }
});

$(document).on('click', '#limenu', function () {

    $("#indentIcon").toggleClass("layui-icon-shrink-right")
    $("#indentIcon").toggleClass("layui-icon-spread-left")
    let isShwo = $(".layui-logo").css("display") == "none"
    window.sessionStorage.setItem("isShowMenu", !isShwo)
    if (isShwo) {
        $("#menu").show();
        $(".layui-side ").show();
        $(".layui-logo").show()
        $(".layui-body").css("left", "200px");
        $(".layui-layout-left").css("left", "200px");
    } else {
        $(".layui-logo").hide()
        $("#menu").hide();
        $(".layui-body").css("left", "0px");
        $(".layui-layout-left").css("left", "0px");
        $(".layui-side ").hide();
    }
})

$(document).on('mouseenter', '#limenu', function() {
    $("#menu").show();
    $(".layui-side ").show();
    $(".layui-body").css("left", "200px");
})

$(document).on('mouseleave', '#menu', function() {
    if($(".layui-logo").css("display")=="none") {
        $("#menu").hide();
        $(".layui-side ").hide();
        $(".layui-body").css("left", "0px");
    }
})



function loginOut() {
    $.session.remove('token');
    $.session.remove('user');
    window.location="login";
}

